import request from '@/utils/request'

// 获取商品列表
export const fetchProductList = (params) => {
    return request({
        url: '/product/list',
        method: 'get',
        params: params
    })
}

// 获取商品列表（简单信息）
export const fetchSimpleList = (params) => {
    return request({
        url: '/product/simpleList',
        method: 'get',
        params: params
    })
}

// 删除商品状态
export const updateDeleteStatus = (params) => {
    return request({
        url: '/product/update/deleteStatus',
        method: 'post',
        params: params
    })
}

// 更新商品上下架状态
export const updatePublishStatus = (params) => {
    return request({
        url: '/product/update/publishStatus',
        method: 'post',
        params: params
    })
}

// 更新商品新品状态
export const updateNewStatus = (params) => {
    return request({
        url: '/product/update/newStatus',
        method: 'post',
        params: params
    })
}

// 更新商品推荐状态
export const updateProRecommendStatus = (params) => {
    return request({
        url: '/product/update/recommendStatus',
        method: 'post',
        params: params
    })
}


// 创建商品
export const createProduct = (data) => {
    return request({
        url: '/product/create',
        method: 'post',
        data: data
    })
}

// 更新商品
export const updateProduct = (id, data) => {
    return request({
        url: '/product/update/' + id,
        method: 'post',
        data: data
    })
}

// 获取商品信息
export const getProduct = (id) => {
    return request({
        url: '/product/updateInfo/' + id,
        method: 'get',
    })
}

